Dynomotion

Group: DynoMotion Message: 3412 From: himykabibble Date: 1/24/2012
Subject: Another Strange Problem...
I have several places in my controller where I run small DSP programs, but they don't always seem to run reliably. The DSP code itself runs perfectly with KMotionCNC. I'm running them with code like this:

String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C Programs\Common\NewHome.c", false);
if (s.Equals(""))
KMController.WriteLine("Execute3");
else
MessageBox.Show(s, "Home.C Compile/Load Failed!");

Should I have something more than that? This particular example is a simple home routine, but it consistently gets to the point where the axis should start moving:

MoveRelAtVel(2, 20000, 10000);
while (ReadBit(HOME_LIMIT))
{
if (CheckDone(AXIS_Z))
{
Jog(AXIS_Z, 0);
printf("DoProbe failed\n");
return -1;
}
}

But the Z axis never moves, so it just hangs in the while loop. The axis is configured and enabled, and works fine running G-code.

Regards,
Ray L.
Group: DynoMotion Message: 3413 From: Brad Murry Date: 1/24/2012
Subject: Re: Another Strange Problem...

I wonder if this may be related to the MainPathRoot issue and not properly finding the TCC67?

 

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of himykabibble
Sent: Wednesday, January 25, 2012 12:03 AM
To: DynoMotion@yahoogroups.com
Subject: [DynoMotion] Another Strange Problem...

 

 

I have several places in my controller where I run small DSP programs, but they don't always seem to run reliably. The DSP code itself runs perfectly with KMotionCNC. I'm running them with code like this:

String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C Programs\Common\NewHome.c", false);
if (s.Equals(""))
KMController.WriteLine("Execute3");
else
MessageBox.Show(s, "Home.C Compile/Load Failed!");

Should I have something more than that? This particular example is a simple home routine, but it consistently gets to the point where the axis should start moving:

MoveRelAtVel(2, 20000, 10000);
while (ReadBit(HOME_LIMIT))
{
if (CheckDone(AXIS_Z))
{
Jog(AXIS_Z, 0);
printf("DoProbe failed\n");
return -1;
}
}

But the Z axis never moves, so it just hangs in the while loop. The axis is configured and enabled, and works fine running G-code.

Regards,
Ray L.

Group: DynoMotion Message: 3414 From: himykabibble Date: 1/24/2012
Subject: Re: Another Strange Problem...
Brad,

But it is compiling, loading and running the program. It just appears the program does not run correctly. I get the printfs that precede that first move, but the move never happens, and I have a printf at the line immediately before the MoveRelAtVel, which shows me the arguments to the MoveRelAtVel, and they are correct.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@...> wrote:
>
> I wonder if this may be related to the MainPathRoot issue and not properly
> finding the TCC67?
>
>
>
>
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of himykabibble
> Sent: Wednesday, January 25, 2012 12:03 AM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] Another Strange Problem...
>
>
>
>
>
> I have several places in my controller where I run small DSP programs, but
> they don't always seem to run reliably. The DSP code itself runs perfectly
> with KMotionCNC. I'm running them with code like this:
>
> String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C
> Programs\Common\NewHome.c", false);
> if (s.Equals(""))
> KMController.WriteLine("Execute3");
> else
> MessageBox.Show(s, "Home.C Compile/Load Failed!");
>
> Should I have something more than that? This particular example is a simple
> home routine, but it consistently gets to the point where the axis should
> start moving:
>
> MoveRelAtVel(2, 20000, 10000);
> while (ReadBit(HOME_LIMIT))
> {
> if (CheckDone(AXIS_Z))
> {
> Jog(AXIS_Z, 0);
> printf("DoProbe failed\n");
> return -1;
> }
> }
>
> But the Z axis never moves, so it just hangs in the while loop. The axis is
> configured and enabled, and works fine running G-code.
>
> Regards,
> Ray L.
>
Group: DynoMotion Message: 3415 From: Brad Murry Date: 1/25/2012
Subject: Re: Another Strange Problem...

Hello Ray,

 

You are running your init program first?

 

-Brad Murry

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of himykabibble
Sent: Wednesday, January 25, 2012 12:42 AM
To: DynoMotion@yahoogroups.com
Subject: [DynoMotion] Re: Another Strange Problem...

 

 

Brad,

But it is compiling, loading and running the program. It just appears the program does not run correctly. I get the printfs that precede that first move, but the move never happens, and I have a printf at the line immediately before the MoveRelAtVel, which shows me the arguments to the MoveRelAtVel, and they are correct.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@...> wrote:
>
> I wonder if this may be related to the MainPathRoot issue and not properly
> finding the TCC67?
>
>
>
>
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of himykabibble
> Sent: Wednesday, January 25, 2012 12:03 AM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] Another Strange Problem...
>
>
>
>
>
> I have several places in my controller where I run small DSP programs, but
> they don't always seem to run reliably. The DSP code itself runs perfectly
> with KMotionCNC. I'm running them with code like this:
>
> String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C
> Programs\Common\NewHome.c", false);
> if (s.Equals(""))
> KMController.WriteLine("Execute3");
> else
> MessageBox.Show(s, "Home.C Compile/Load Failed!");
>
> Should I have something more than that? This particular example is a simple
> home routine, but it consistently gets to the point where the axis should
> start moving:
>
> MoveRelAtVel(2, 20000, 10000);
> while (ReadBit(HOME_LIMIT))
> {
> if (CheckDone(AXIS_Z))
> {
> Jog(AXIS_Z, 0);
> printf("DoProbe failed\n");
> return -1;
> }
> }
>
> But the Z axis never moves, so it just hangs in the while loop. The axis is
> configured and enabled, and works fine running G-code.
>
> Regards,
> Ray L.
>

Group: DynoMotion Message: 3416 From: himykabibble Date: 1/25/2012
Subject: Re: Another Strange Problem...
Brad,

Yes, and it never seems to fail.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@...> wrote:
>
> Hello Ray,
>
>
>
> You are running your init program first?
>
>
>
> -Brad Murry
>
>
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of himykabibble
> Sent: Wednesday, January 25, 2012 12:42 AM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] Re: Another Strange Problem...
>
>
>
>
>
> Brad,
>
> But it is compiling, loading and running the program. It just appears the
> program does not run correctly. I get the printfs that precede that first
> move, but the move never happens, and I have a printf at the line
> immediately before the MoveRelAtVel, which shows me the arguments to the
> MoveRelAtVel, and they are correct.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> Brad Murry <bradodarb@> wrote:
> >
> > I wonder if this may be related to the MainPathRoot issue and not properly
> > finding the TCC67?
> >
> >
> >
> >
> >
> > From: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> [mailto:DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ]
> On
> > Behalf Of himykabibble
> > Sent: Wednesday, January 25, 2012 12:03 AM
> > To: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > Subject: [DynoMotion] Another Strange Problem...
> >
> >
> >
> >
> >
> > I have several places in my controller where I run small DSP programs, but
> > they don't always seem to run reliably. The DSP code itself runs perfectly
> > with KMotionCNC. I'm running them with code like this:
> >
> > String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C
> > Programs\Common\NewHome.c", false);
> > if (s.Equals(""))
> > KMController.WriteLine("Execute3");
> > else
> > MessageBox.Show(s, "Home.C Compile/Load Failed!");
> >
> > Should I have something more than that? This particular example is a
> simple
> > home routine, but it consistently gets to the point where the axis should
> > start moving:
> >
> > MoveRelAtVel(2, 20000, 10000);
> > while (ReadBit(HOME_LIMIT))
> > {
> > if (CheckDone(AXIS_Z))
> > {
> > Jog(AXIS_Z, 0);
> > printf("DoProbe failed\n");
> > return -1;
> > }
> > }
> >
> > But the Z axis never moves, so it just hangs in the while loop. The axis
> is
> > configured and enabled, and works fine running G-code.
> >
> > Regards,
> > Ray L.
> >
>
Group: DynoMotion Message: 3421 From: Tom Kerekes Date: 1/25/2012
Subject: Re: Another Strange Problem...
Hi Ray,
 
I can't really think of anything.  Possibilities might be that you have a bug somewhere else that is corrupting something.  Or possibly the download of the C program is somehow getting corrupted.  If somebody isn't playing by the rules and respecting the Token then commands/data can get intermixed and so forth.  But that type of thing usually results in an error of some sort.
 
Regards
TK

Group: DynoMotion Message: 3422 From: himykabibble Date: 1/25/2012
Subject: Re: Another Strange Problem...
Brad,

Am I supposed to be doing something with the token? Right now I'm not....

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> I can't really think of anything.  Possibilities might be that you have a bug somewhere else that is corrupting something.  Or possibly the download of the C program is somehow getting corrupted.  If somebody isn't playing by the rules and respecting the Token then commands/data can get intermixed and so forth.  But that type of thing usually results in an error of some sort.
>  
> Regards
> TK
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, January 25, 2012 5:38 AM
> Subject: [DynoMotion] Re: Another Strange Problem...
>
>
>  
> Brad,
>
> Yes, and it never seems to fail.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> >
> > Hello Ray,
> >
> >
> >
> > You are running your init program first?
> >
> >
> >
> > -Brad Murry
> >
> >
> >
> > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > Behalf Of himykabibble
> > Sent: Wednesday, January 25, 2012 12:42 AM
> > To: DynoMotion@yahoogroups.com
> > Subject: [DynoMotion] Re: Another Strange Problem...
> >
> >
> >
> >
> >
> > Brad,
> >
> > But it is compiling, loading and running the program. It just appears the
> > program does not run correctly. I get the printfs that precede that first
> > move, but the move never happens, and I have a printf at the line
> > immediately before the MoveRelAtVel, which shows me the arguments to the
> > MoveRelAtVel, and they are correct.
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > Brad Murry <bradodarb@> wrote:
> > >
> > > I wonder if this may be related to the MainPathRoot issue and not properly
> > > finding the TCC67?
> > >
> > >
> > >
> > >
> > >
> > > From: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > [mailto:DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ]
> > On
> > > Behalf Of himykabibble
> > > Sent: Wednesday, January 25, 2012 12:03 AM
> > > To: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > > Subject: [DynoMotion] Another Strange Problem...
> > >
> > >
> > >
> > >
> > >
> > > I have several places in my controller where I run small DSP programs, but
> > > they don't always seem to run reliably. The DSP code itself runs perfectly
> > > with KMotionCNC. I'm running them with code like this:
> > >
> > > String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C
> > > Programs\Common\NewHome.c", false);
> > > if (s.Equals(""))
> > > KMController.WriteLine("Execute3");
> > > else
> > > MessageBox.Show(s, "Home.C Compile/Load Failed!");
> > >
> > > Should I have something more than that? This particular example is a
> > simple
> > > home routine, but it consistently gets to the point where the axis should
> > > start moving:
> > >
> > > MoveRelAtVel(2, 20000, 10000);
> > > while (ReadBit(HOME_LIMIT))
> > > {
> > > if (CheckDone(AXIS_Z))
> > > {
> > > Jog(AXIS_Z, 0);
> > > printf("DoProbe failed\n");
> > > return -1;
> > > }
> > > }
> > >
> > > But the Z axis never moves, so it just hangs in the while loop. The axis
> > is
> > > configured and enabled, and works fine running G-code.
> > >
> > > Regards,
> > > Ray L.
> > >
> >
>
Group: DynoMotion Message: 3423 From: himykabibble Date: 1/25/2012
Subject: Re: Another Strange Problem...
Brad,

How do I know when a thread has completed?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> I can't really think of anything.  Possibilities might be that you have a bug somewhere else that is corrupting something.  Or possibly the download of the C program is somehow getting corrupted.  If somebody isn't playing by the rules and respecting the Token then commands/data can get intermixed and so forth.  But that type of thing usually results in an error of some sort.
>  
> Regards
> TK
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, January 25, 2012 5:38 AM
> Subject: [DynoMotion] Re: Another Strange Problem...
>
>
>  
> Brad,
>
> Yes, and it never seems to fail.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> >
> > Hello Ray,
> >
> >
> >
> > You are running your init program first?
> >
> >
> >
> > -Brad Murry
> >
> >
> >
> > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > Behalf Of himykabibble
> > Sent: Wednesday, January 25, 2012 12:42 AM
> > To: DynoMotion@yahoogroups.com
> > Subject: [DynoMotion] Re: Another Strange Problem...
> >
> >
> >
> >
> >
> > Brad,
> >
> > But it is compiling, loading and running the program. It just appears the
> > program does not run correctly. I get the printfs that precede that first
> > move, but the move never happens, and I have a printf at the line
> > immediately before the MoveRelAtVel, which shows me the arguments to the
> > MoveRelAtVel, and they are correct.
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > Brad Murry <bradodarb@> wrote:
> > >
> > > I wonder if this may be related to the MainPathRoot issue and not properly
> > > finding the TCC67?
> > >
> > >
> > >
> > >
> > >
> > > From: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > [mailto:DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ]
> > On
> > > Behalf Of himykabibble
> > > Sent: Wednesday, January 25, 2012 12:03 AM
> > > To: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > > Subject: [DynoMotion] Another Strange Problem...
> > >
> > >
> > >
> > >
> > >
> > > I have several places in my controller where I run small DSP programs, but
> > > they don't always seem to run reliably. The DSP code itself runs perfectly
> > > with KMotionCNC. I'm running them with code like this:
> > >
> > > String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C
> > > Programs\Common\NewHome.c", false);
> > > if (s.Equals(""))
> > > KMController.WriteLine("Execute3");
> > > else
> > > MessageBox.Show(s, "Home.C Compile/Load Failed!");
> > >
> > > Should I have something more than that? This particular example is a
> > simple
> > > home routine, but it consistently gets to the point where the axis should
> > > start moving:
> > >
> > > MoveRelAtVel(2, 20000, 10000);
> > > while (ReadBit(HOME_LIMIT))
> > > {
> > > if (CheckDone(AXIS_Z))
> > > {
> > > Jog(AXIS_Z, 0);
> > > printf("DoProbe failed\n");
> > > return -1;
> > > }
> > > }
> > >
> > > But the Z axis never moves, so it just hangs in the while loop. The axis
> > is
> > > configured and enabled, and works fine running G-code.
> > >
> > > Regards,
> > > Ray L.
> > >
> >
>
Group: DynoMotion Message: 3424 From: Tom Kerekes Date: 1/25/2012
Subject: Re: Another Strange Problem...
Ray,
 
The WriteLineReadLine and LoadCoff routines all handle waiting for the Token and releasing the Token internally.  The only responsibility an Application has is in rare cases where it is issuing a command that needs to send multiple lines of connsecutive commands/data or receive multiple lines of data.  So for example to upload a block of Gather Buffer data might require 4 calls of WriteLine, ReadLine, ReadLine, Readline.  In this case you are required to get the Token at the beginning and release it at the end otherwise you might get pre-empted in the middle and some other process or thread might issue a command/response and end up receiving the wrong data.
 
GetStatus falls into this catagory.  But I believe it is Waiting for the Token properly and if it doesn't obtain it it doesn't perform the operation.
 
Again I'm just grasping at straws on what your problem might be...
 
Regards
TK 
Group: DynoMotion Message: 3426 From: Tom Kerekes Date: 1/25/2012
Subject: Re: Another Strange Problem...
Ray,
 
There is a Console Command CheckThreadX.  Thread status is also included in the MainStatus.
 
 
TK
 

Group: DynoMotion Message: 3431 From: quelisto Date: 1/25/2012
Subject: Re: Another Strange Problem...
You can use a global variable as a flag to signal that a thread has completed a task. If you're running on the KFlop itself, you can use the persist data structure (an array of integers).


--- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@...> wrote:
>
> Brad,
>
> How do I know when a thread has completed?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Ray,
> >  
> > I can't really think of anything.  Possibilities might be that you have a bug somewhere else that is corrupting something.  Or possibly the download of the C program is somehow getting corrupted.  If somebody isn't playing by the rules and respecting the Token then commands/data can get intermixed and so forth.  But that type of thing usually results in an error of some sort.
> >  
> > Regards
> > TK
> >
> > From: himykabibble <jagboy@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, January 25, 2012 5:38 AM
> > Subject: [DynoMotion] Re: Another Strange Problem...
> >
> >
> >  
> > Brad,
> >
> > Yes, and it never seems to fail.
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> > >
> > > Hello Ray,
> > >
> > >
> > >
> > > You are running your init program first?
> > >
> > >
> > >
> > > -Brad Murry
> > >
> > >
> > >
> > > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > > Behalf Of himykabibble
> > > Sent: Wednesday, January 25, 2012 12:42 AM
> > > To: DynoMotion@yahoogroups.com
> > > Subject: [DynoMotion] Re: Another Strange Problem...
> > >
> > >
> > >
> > >
> > >
> > > Brad,
> > >
> > > But it is compiling, loading and running the program. It just appears the
> > > program does not run correctly. I get the printfs that precede that first
> > > move, but the move never happens, and I have a printf at the line
> > > immediately before the MoveRelAtVel, which shows me the arguments to the
> > > MoveRelAtVel, and they are correct.
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > Brad Murry <bradodarb@> wrote:
> > > >
> > > > I wonder if this may be related to the MainPathRoot issue and not properly
> > > > finding the TCC67?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > From: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > > [mailto:DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ]
> > > On
> > > > Behalf Of himykabibble
> > > > Sent: Wednesday, January 25, 2012 12:03 AM
> > > > To: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > > > Subject: [DynoMotion] Another Strange Problem...
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I have several places in my controller where I run small DSP programs, but
> > > > they don't always seem to run reliably. The DSP code itself runs perfectly
> > > > with KMotionCNC. I'm running them with code like this:
> > > >
> > > > String s = KMController.CompileAndLoadCoff(3, @"C:\My KFlop C
> > > > Programs\Common\NewHome.c", false);
> > > > if (s.Equals(""))
> > > > KMController.WriteLine("Execute3");
> > > > else
> > > > MessageBox.Show(s, "Home.C Compile/Load Failed!");
> > > >
> > > > Should I have something more than that? This particular example is a
> > > simple
> > > > home routine, but it consistently gets to the point where the axis should
> > > > start moving:
> > > >
> > > > MoveRelAtVel(2, 20000, 10000);
> > > > while (ReadBit(HOME_LIMIT))
> > > > {
> > > > if (CheckDone(AXIS_Z))
> > > > {
> > > > Jog(AXIS_Z, 0);
> > > > printf("DoProbe failed\n");
> > > > return -1;
> > > > }
> > > > }
> > > >
> > > > But the Z axis never moves, so it just hangs in the while loop. The axis
> > > is
> > > > configured and enabled, and works fine running G-code.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > >
> >
>